<?php
/**
 * Created by 荣耀电竞.
 * User: 林子彦 <278805354@qq.com>
 * Date: 2018/6/23 0023
 * Time: 17:18
 */
namespace App\Shop\Repositories;
use App\Shop\Contracts\GoodsClassInterface;
use App\Shop\Models\GoodsClassModel;

class  DbGoodsClassRepository implements GoodsClassInterface{

    /**
     * @return GoodsClassModel
     */
    public function getGoodsClassModel(){
        return app()->make(GoodsClassModel::class);
    }
    public function getGoodsClassList($where){
        return $this->getGoodsClassModel()->newQuery()->where($where)->get();
    }

    /**
     * 产品删除
     * @param $where
     * @return mixed
     */
    public function delGoodsClass($where){
        return $this->getGoodsClassModel()->newQuery()->where($where)->delete();
    }

    /**
     * 添加与保存
     * @param $data
     * @return \Illuminate\Database\Eloquent\Model
     */
    public function updateOrCreateConfigClassData($data){
        return $this->getGoodsClassModel()->newQuery()->updateOrCreate(["id" => $data["id"]], $data);
    }

    /**
     * 获取商品分类信息
     * @param $where
     * @return mixed|void
     */
    public function getGoodsClassInfo($where){
        return $this->getGoodsClassModel()->newQuery()->where($where)->first();
    }
}